package com.bw.module_merchant.activity

import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import androidx.fragment.app.Fragment

import com.example.lib_common.view.view.BaseMvvmActivity
import com.example.module_merchant.R
import com.example.module_merchant.databinding.ActivityAddEnterpriseBinding


import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AddEnterpriseActivity : BaseMvvmActivity<ActivityAddEnterpriseBinding>() {

    private var application :Boolean = false
    private var record :Boolean = false





     override fun initViews() {

        // 默认显示“入住申请” Fragment
        replaceFragment(MerchantApplicationsFragment())




        // 设置 Tab 点击事件
        binding.merchantApplications.setOnClickListener { v ->
            binding.merchantApplications.setTextColor(Color.parseColor("#007660"))
            binding.merchantApplicationsInd.setBackgroundResource(R.drawable.ind_select)


            binding.merchantRecord.setTextColor(Color.parseColor("#000000"))
            binding.merchantRecordInd.setBackgroundResource(R.drawable.ind_unselect)
            replaceFragment(MerchantApplicationsFragment())
        }

        binding.merchantRecord.setOnClickListener { v ->
            binding.merchantApplications.setTextColor(Color.parseColor("#000000"))
            binding.merchantApplicationsInd.setBackgroundResource(R.drawable.ind_unselect)


            binding.merchantRecord.setTextColor(Color.parseColor("#007660"))
            binding.merchantRecordInd.setBackgroundResource(R.drawable.ind_select)
            replaceFragment(MerchantRecordFragment())
        }

        binding.check.setOnClickListener {
            startActivity(Intent(this , EnterpriseApproveActivity::class.java))
        }
    }
    private fun replaceFragment(fragment: Fragment) {
        supportFragmentManager.beginTransaction()
            .replace(R.id.fragment, fragment)
            .commit()
    }

    override fun getLayoutId(): Int =R.layout.activity_add_enterprise



    override fun getActivityState(state: Bundle) {
        TODO("Not yet implemented")
    }

    override fun saveActivityState(outState: Bundle) {
        TODO("Not yet implemented")
    }

}